<template>
    <MasterCard :config="masterCardConfig" />
    <TransferCardConfig :config="transferCardConfig" />
    <WalletConfig :config="walletConfig" />
    <AgencyrebateConfig :config="agencyrebateConfig" />
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { queryConfigInfo } from '@/api/config'
import MasterCard from './MasterCard.vue'
import AgencyrebateConfig from './AgencyrebateConfig.vue'
import TransferCardConfig from './TransferCardConfig.vue'
import WalletConfig from './WalletConfig.vue'

const masterCardConfig = ref<Api.Config.MasterCardConfig | null>(null)
const agencyrebateConfig = ref<Api.Config.AgencyrebateConfig | null>(null)
const transferCardConfig = ref<Api.Config.TransferCardConfig | null>(null)
const walletConfig = ref<Api.Config.WalletConfig | null>(null)

async function queryAllCofig() {
    const [err, res] = await queryConfigInfo()

    if (!err && res) {
        masterCardConfig.value = res.masterCardConfig
        agencyrebateConfig.value = res.agencyrebateConfig
        transferCardConfig.value = res.transferCardConfig
        walletConfig.value = res.walletConfig
    }
}

queryAllCofig()
</script>
